﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Acme.Sakila.TestSite
{
	internal static class Extensions
	{
		public static int? ToInt32(this string v)
		{
			int r;
			if (int.TryParse(v, out r))
				return r;
			else
				return null;
		}

		public static bool IsValidatable(this System.Web.UI.Control control)
		{
			if (control is System.Web.UI.WebControls.TextBox)
			{
				return true;
			}
			else if (control is System.Web.UI.WebControls.CheckBox)
			{
				return true;
			}
			else if (control is System.Web.UI.WebControls.RadioButton)
			{
				return true;
			}

			return false;
		}
	}
}